package com.shycloud.mido.homework.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shycloud.mido.common.core.util.R;
import com.shycloud.mido.homework.api.vo.MidoHomeworkMainVOMini;
import java.time.LocalDate;
import java.util.Date;
import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;

import com.baomidou.mybatisplus.annotation.SqlParser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.shycloud.mido.homework.api.dto.SearchDto;
import com.shycloud.mido.homework.api.entity.MidoHomeworkMain;
import com.shycloud.mido.homework.api.vo.AtvActiveDetailItemVO;
import com.shycloud.mido.homework.api.vo.AtvActiveDetailReqVO;
import com.shycloud.mido.homework.api.vo.AtvScheduleVO;
import com.shycloud.mido.homework.api.vo.HomeworkDataVO;
import com.shycloud.mido.homework.api.vo.MidoHomeworkMainVO;
import com.shycloud.mido.homework.api.vo.MusicNameVO;

public interface MidoHomeworkMainMapper extends BaseMapper<MidoHomeworkMain> {

	IPage<MidoHomeworkMain> page(@Param("search") SearchDto search);

	String getTeacherName(@Param("teacherId") String teacherId);

	/**
	 * 获取当天作业完成状态
	 *
	 * @param startDate
	 * @param studentId
	 * @return java.util.List<java.lang.String>
	 * @author nianhua.jiang
	 * @date 2020/7/3 18:35
	 */
	List<String> getHomeWorkStatus(@Param("startDate") LocalDate startDate,
			@Param("studentId") String studentId,
			@Param("teacherId") String teacherId);

	List<String> getHomeWorkDing(@Param("startDate") LocalDate startDate,
			@Param("studentId") String studentId,
			@Param("teacherId") String teacherId);

	/**
	 * 更新提醒状态
	 *
	 * @param studentId
	 * @param startDate
	 * @return int
	 * @author nianhua.jiang
	 * @date 2020/7/5 14:36
	 */
	int updateDing(@Param("studentId") String studentId,
			@Param("startDate") String startDate,
			@Param("teacherId") String teacherId);

	/**
	 * 获取筛选作业列表
	 *
	 * @param studentId
	 * @param startDate
	 * @return java.util.List<java.util.Map < java.lang.String, java.lang.Object>>
	 * @author nianhua.jiang
	 * @date 2020/7/8 9:44
	 */
	List<MusicNameVO> getHomeworkMusicList(@Param("studentId") String studentId,
			@Param("startDate") String startDate,
			@Param("teacherId") String teacherId);

	/**
	 * 获取筛选作业列表
	 *
	 * @param studentId
	 * @param startDate
	 * @return java.util.List<java.util.Map < java.lang.String, java.lang.Object>>
	 * @author nianhua.jiang
	 * @date 2020/7/8 9:44
	 */
	List<MusicNameVO> getHomeworkHelpMusicList(@Param("studentId") String studentId,
			@Param("startDate") String startDate,
			@Param("teacherId") String teacherId);

	/**
	 * 获取作业列表
	 *
	 * @param studentId
	 * @param startDate
	 * @param musicId
	 * @return java.lang.Throwable
	 * @author nianhua.jiang
	 * @date 2020/7/8 10:00
	 */
	List<MidoHomeworkMainVO> getHomework(@Param("studentId") String studentId,
			@Param("startDate") String startDate,
			@Param("musicId") Integer musicId,
			@Param("isParentMode") String isParentMode,
			@Param("teacherId") String teacherId);

	IPage<MidoHomeworkMainVO> getHomeworkPage(IPage<MidoHomeworkMainVO> page,
			@Param("studentId") String studentId,
			@Param("startDate") String startDate,
			@Param("musicId") Integer musicId,
			@Param("isParentMode") String isParentMode,
			@Param("teacherId") String teacherId);

	IPage<MidoHomeworkMainVOMini> getHomeworkPageMini(IPage<MidoHomeworkMainVOMini> page,
			@Param("studentId") String studentId,
			@Param("startDate") String startDate,
			@Param("musicId") Integer musicId,
			@Param("isParentMode") String isParentMode,
			@Param("teacherId") String teacherId);

	List<MidoHomeworkMainVO> getHomeworkPlayer(@Param("studentId") String studentId,
			@Param("startDate") String startDate,
			@Param("musicId") Integer musicId,
			@Param("teacherId") String teacherId,
			@Param("isParentMode") String isParentMode);

	List<HomeworkDataVO> getSummaryStatistics(@Param("studentId") String studentId,
			@Param("musicId") Integer musicId,
			@Param("teacherId") String teacherId);

	Integer getIsByCollection(@Param("memberId") String memberId,
			@Param("collectionId") String collectionId);

	//小程序使用
	List<Map> getStudentTodayMusic(@Param("studentId") String studentId,
			@Param("startDate") String startDate,
			@Param("teacherId") String teacherId);

	List<MidoHomeworkMainVO> getHomeworkV2Detail(@Param("groupId") long groupId,
			@Param("playingMode") String playingMode,
			//获取所属表
			@Param("teacherId") String teacherId,
			@Param("studentId") String studentId,
			@Param("startDate") String startDate);

	int updateDingV2(@Param("teacherId") String teacherId, @Param("studentId") String studentId,
			@Param("startDate") String startDate);

	//=====================测试 =======================//
	List<String> getStudentIdList();

	List<MidoHomeworkMain> getHomeworkTest(@Param("studentId") String studentId,
			@Param("isParentMode") String isParentMode);

	boolean updateGroupId(@Param("groupId") Long groupId, @Param("id") Long id);

	String getRegIdByStudentId(@Param("studentId") String studentId);

	Map<String, String> getRemindStudentPushMessage(@Param("id") int id);

	String getTeacherId(@Param("teacherId") String teacherId);

	@SqlParser(filter = true)
	boolean insertPushQuertz(@Param("memberId") String memberId,
			@Param("studentId") String studentId, @Param("teacherId") String teacherId,
			@Param("type") String type);

	String getRegIdByMemberId(@Param("memberId") String memberId);

	List<MidoHomeworkMain> getHomeworkPush(@Param("groupId") Long groupId,
			@Param("playingMode") String playingMode, @Param("startDate") String startDate);

	String getMemberIdByStudentId(@Param("studentId") String studentId);

	List<MidoHomeworkMain> getHomeWorkDingDetail(@Param("startDate") String startDate,
			@Param("teacherId") String teacherId, @Param("studentId") String studentId);

	int deleteHomeworkBatchV2(@Param("groupId") String groupId,
			@Param("playingMode") String playingMode, @Param("startDate") String startDate);

	List<String> getHomeworkIdListByGroupId(@Param("groupId") String groupId,
			@Param("playingMode") String playingMode, @Param("startDate") String startDate);

	List<AtvActiveDetailItemVO> studentActiveDatailByComplate(
			@Param("param") AtvActiveDetailReqVO vo);

	List<AtvActiveDetailItemVO> studentActiveDatailByHomework(
			@Param("param") AtvActiveDetailReqVO vo);

	List<AtvScheduleVO> getAtvStudentDetail(@Param("mainAtvId") String mainAtvId);

	List<AtvScheduleVO> getOkDays(@Param("beginDatetime") Date beginDatetime,
			@Param("endDatetime") Date endDatetime, @Param("studentIds") List<String> studentIds);

	List<AtvScheduleVO> getTotalTimes(@Param("beginDatetime") Date beginDatetime,
			@Param("endDatetime") Date endDatetime, @Param("studentIds") List<String> studentIds);

	String getstudentIdByMemberId(@Param("memberId") String memberId);

	List<String> getHomeWorkStatusByStu(@Param("startDate") LocalDate startDate,
			@Param("studentId") String studentId);

	List<String> getHomeWorkDingByStu(@Param("startDate") LocalDate startDate,
			@Param("studentId") String studentId);

	List<String> getHomeWorkStatusByStuStr(@Param("startDate") String startDate,
			@Param("studentId") String studentId);

	List<String> getHomeworkRecordingUrl(
			@Param("startTime") String startTime, @Param("endTime") String endTime);

	String getStudentIdByUsername(@Param("username") String username);

	List<String> getHomeWorkStatusByMulti(@Param("startDate") LocalDate startDate,
			@Param("studentId") String studentId,
			@Param("teacherIds") List<String> teacherIds);

	List<String> getHomeWorkDingByMulti(@Param("startDate") LocalDate startDate,
			@Param("studentId") String studentId,
			@Param("teacherIds") List<String> teacherIds);

	String getStudentNameById(@Param("studentId") String studentId);

	String getMemberNameByStuId(@Param("studentId") String studentId);

	/**
	 * 多师琴房获取作业列表
	 *
	 * @param studentId    学生ID
	 * @param startDate    作业日期
	 * @param musicId      曲目ID
	 * @param isParentMode 作业下发类型(目标/教师)
	 * @param teacherIds   教师ID集合
	 * @return
	 * @author nianhua.jiang
	 * @date 2021/8/10 9:03
	 */
	List<MidoHomeworkMainVO> getHomeworkV3(
			@Param("studentId") String studentId,
			@Param("startDate") String startDate,
			@Param("musicId") Integer musicId,
			@Param("isParentMode") String isParentMode,
			@Param("teacherIds") List<String> teacherIds);

	List<MusicNameVO> getHomeworkMusicListV3(
			@Param("studentId") String studentId, @Param("startDate") String startDate, @Param("teacherIds") List<String> teacherIds);

	IPage<MidoHomeworkMainVO> getHomeworkPlayerV3(
			@Param("page") Page page,
			@Param("studentId") String studentId,
			@Param("startDate") String startDate,
			@Param("musicId") Integer musicId,
			@Param("teacherIds") List<String> teacherIds);
}
